export default {
    state: {
        isCollapse: false, //控制菜单展开状态
        tabsList:[
            {
                id:'1',
                path:"/home",
                name:"home",
                label:"首页",
                icon:"el-icon-s-home",
                url:"Home/Home"
            }
        ],
        tokenStatus: false,//面包屑数据
        divHeight:null
    },
    mutations: {
        transportHeight(state,newHeight){
            state.divHeight = newHeight
        },
        changeTokenStatus(state,flag){
            state.tokenStatus = flag
        },
        //控制菜单展开状态
        changeCollapse(state) {
            state.isCollapse = !state.isCollapse
        },
        changeBreadCrumb(state,item){
            // console.log("item")
            //不是首页
            if(item.name !== 'home'){
                let index = state.tabsList.findIndex(listItem =>{
                    return item.name === listItem.name
                })
                //如果不存在
                if(index === -1){
                    state.tabsList.push(item)
                }
            }
        },
        //删除指定的tag数据
        closeTag(state,item){
            console.log(item)
            const index = state.tabsList.findIndex(val => val.name === item.name);
            if (index > -1) {
                state.tabsList.splice(index, 1);
            }
        }
    },
}